package org.redis.cluster.loadbalance.slot;

import org.redis.cluster.config.ClientConfig;

public class SlotClientConfigAdapter {

	/**
	 * @param slotClientConfig
	 * @return
	 */
	public static ClientConfig adaptClientConfig(SlotClientConfig slotClientConfig) {
		ClientConfig clientConfig=new ClientConfig();
		clientConfig.setClient(slotClientConfig.getClient());
		clientConfig.setHost(slotClientConfig.getHost());
		clientConfig.setPort(slotClientConfig.getPort());
		clientConfig.setConnection(slotClientConfig.getConnection());
		clientConfig.setTimeout(slotClientConfig.getTimeout());
		
		if(slotClientConfig.getId()!=null) {
			clientConfig.setId(slotClientConfig.getId());
		}
		else {
			slotClientConfig.setId(clientConfig.getId());
		}
		
		return clientConfig;
	}
}